import {Color} from './color';
import {Parsers} from './type';
import {parsers} from './parse';

export type Plugin = (colorClass: typeof Color, parsers: Parsers) => void;

const activePlugins: Plugin[] = [];

export const extend = (plugins: Plugin[]): void => {
    plugins.forEach((plugin) => {
        if (activePlugins.indexOf(plugin) < 0) {
            plugin(Color, parsers);
            activePlugins.push(plugin);
        }
    });
};
